<meta http-equiv="expires" content="0">
<!-- says that the cache expires 'now' -->
<meta http-equiv="expires" content="0">
<!-- says that the cache expires 'now' -->
<meta http-equiv="pragma" content="no-cache">
<!-- says not to use cached stuff, if there is any -->

<%@ page language="java" session="true" import="java.util.*"
	contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%--window.opener.location.href='Url' --%>
<%
String userID = "" ;
try
{
	userID =(String)session.getAttribute("userID");
}
catch(Exception Exp)
{
	Exp.printStackTrace();
	response.sendRedirect("/report/jsp/login.jsp?msg=Session Time Out");
} 
if(userID== null)
{
	response.sendRedirect("/report/jsp/login.jsp?msg=Session Time Out");
}
%>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>U2opia Analytics</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="stylesheet" type="text/css" href="menu.css" />
<script type="text/javascript"
	src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>

<script type="text/javascript">

/*$(document).ready(function(){  
    //If user wants to end session  
    $("#exit").click(function(){  
       
    });  
});*/  
</script>
<script language="javascript" type="text/javascript">


function initStart()
{    
       var Urld ="/report/api/operatorList?reportType=";
       var table = document.getElementById("reportType").value;
	   Urld = Urld+table;
        if (window.XMLHttpRequest)
        {
                xmlhttp=new XMLHttpRequest();
        }
        else
		{
                xmlhttp= new ActiveXObject("Microsoft.HTTP");
        }
         xmlhttp.onreadystatechange=getprofileSubd;
        xmlhttp.open("GET",Urld,true);
        xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
        xmlhttp.send(null);
}
function getprofileSubd()
{
//alert("ion sbf"); 
 if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
			var showdatad=xmlhttp.responseText;
			if(showdatad=="404"){
				alert("Data Not Available in DB");
				return false;
			}
            var showdataBuffd = showdatad.split(",");
				for(i=0;i<showdataBuffd.length;i++)
				{
					 var datadisplay = showdataBuffd[i];
                     document.getElementById("circle").options[i]= new Option(datadisplay);
				}
	getCountryList();
        }
}


function getCountryList(){
	var Urld ="/report/api/CountryList?operatorName=";
    var table = document.getElementById("circle").value;
	   Urld = Urld+table;
     if (window.XMLHttpRequest)
     {
             xmlhttp=new XMLHttpRequest();
     }
     else
		{
             xmlhttp= new ActiveXObject("Microsoft.HTTP");
     }
      xmlhttp.onreadystatechange=setCountry;
     xmlhttp.open("GET",Urld,true);
     xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
     xmlhttp.send(null);	
}
function setCountry()
{
//alert("ion sbf"); 
 if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
			var showdatad=xmlhttp.responseText;
			if(showdatad=="404"){
				alert("Data Not Available in DB");
				return false;
			}
            var showdataBuffd = showdatad.split(",");
				for(i=0;i<showdataBuffd.length;i++)
				{
					 var datadisplay = showdataBuffd[i];
				//	alert(datadisplay);
                     document.getElementById("countryName").options[i]= new Option(datadisplay);
				}
        }
}

function enb()
{

	if(packForm.duration.value=="daily")
	{
		document.getElementById("monthlyInput").style.visibility="hidden";
		document.getElementById("hourlyInput").style.visibility="hidden";
		document.getElementById("dateInput").style.visibility="visible";
	document.getElementById("inputEdate").style.visibility="visible";
		document.getElementById("inputEDate").style.visibility="visible";		
	}else if(packForm.duration.value=="monthly")
	{
		//alert("hh");
		document.getElementById("hourlyInput").style.visibility="hidden";
		document.getElementById("dateInput").style.visibility="hidden";
		document.getElementById("inputEdate").style.visibility="hidden";
		document.getElementById("inputEDate").style.visibility="hidden";
		document.getElementById("monthlyInput").style.visibility="visible";
	}else if(packForm.duration.value=="hourly")
	{
		//alert("hh");
		document.getElementById("hourlyInput").style.visibility="visible";
		document.getElementById("dateInput").style.visibility="visible";
		document.getElementById("monthlyInput").style.visibility="hidden";
		document.getElementById("inputEdate").style.visibility="hidden";
		document.getElementById("inputEDate").style.visibility="hidden";
	}else if(packForm.circletype.value="all"){
		document.getElementById("inputEDate").style.visibility="hidden";
		document.getElementById("endMonth").style.visibility="hidden";		
	}
}
function chk()
{
if( document.getElementById("reportType").value == "BdayWishUssd" && packForm.duration.value != "daily"){
alert("only daily report is available for B'Day Wish in DB");
return false;
}
else{
 return true;
 }
}

</script>
<style type="text/css">
.close_chat_windows {
	display: none;
}
</style>
<link href="jsn/clndrn.css" rel="stylesheet" type="text/css">
<script language="javascript" type="text/javascript" src="jsn/clndr.js"></script>
</head>

<body style="background-image: url(images/bg.png) repeat-x;"
	onload="initStart()">
	<%
	String msg = "";
	try{
		msg = (request.getParameter("msg")).trim();
	}catch(Exception e)
	{
	}	
%>
	<div class="header">
		<!-- Header Area-->

		<div class="header_line_content" style="background: #FFF">
			<!-- Start Header Content Area-->

			<div style="float: left">
				<div
					style="width: 160px; height: 90px; background: url(images/u2opia_mobile_logo.png); margin-left: 1px;"></div>
			</div>

			<div style="float: right; padding-top: 6px">
				<div style="width: auto; height: 90px">
					<div style="float: left">
						<div style="width: 180px">
							<span
								style="float: left; margin-left: 22px; color: #B30000; font-family: Arial, Helvetica, sans-serif; font-size: 16px">Welcome
								:</span>
							<div
								style="float: left; color: #AB1000; font-family: Arial, Helvetica, sans-serif; font-size: 16px; padding-left: 5px;">Admin</div>
							<div
								style="float: left; color: #B30000; font-family: Arial, Helvetica, sans-serif; font-size: 16px; padding-left: 75px;">
								<span style="color: #323232;"></span>
							</div>
							<div
								style="float: left; color: #323232; font-family: Arial, Helvetica, sans-serif; font-size: 16px; padding-left: 100px;">
								<a style="text-decoration: none" href="logout.jsp">Logout</a>
							</div>
						</div>
					</div>
					<div
						style="float: right; background: url(images/1.png); width: 78px; height: 74px; padding-top: 5px;">
						<span style="padding-left: 4px;"><img
							src="friends/DSC02384.JPG" width="69px" height="69px;" /></span>
					</div>

				</div>
			</div>

		</div>
		<!-- END Header Content Area-->

	</div>
	<!-- END Header Area-->

	<div id="content">
		<!-- COntent Area-->


		<div>
			<!-- Header With in content named Welcome Area-->
			<div
				style="height: 34px; background: url(images/header_bg.png) repeat-x;">
				<div
					style="width: 1000px; height: 34px; background: url(images/header_bg.png) repeat-x; padding-top: 7px;">

					<div
						style="float: right; width: 100%; font-family: Arial, Helvetica, sans-serif; font-size: 18px; color: #8F0000; font-weight: 500;">
						<a style="text-decoration: none" href="dashboard.jsp"><span
							style="float: left; margin-left: 10px; color: #FFFFFF; font-size: 16px; font-weight: 300">DashBoard</span></a>
						<div style="z-index: 50"></div>
						<a style="text-decoration: none" href="mis.jsp"><span
							style="float: left; margin-left: 30px; color: #FFFFFF; font-size: 16px; font-weight: 300">Custom Reports</span></a>
						<div style="z-index: 50"></div>
						<a style="text-decoration: none" href="search.jsp"><span
							style="float: left; margin-left: 30px; color: #FFFFFF; font-size: 16px; font-weight: 300">Search</span></a>
						<div style="z-index: 50"></div>


					</div>
				</div>
			</div>
			<!-- END Header With in content named Welcome Area-->

			<!--Main Content Goes Here -->
			<div id="content">
				<div id="mainContent" align="center">
					<form onsubmit="return chk()" method="get"
						action="/report/api/excel" name="packForm">
						<table border="0"
							style="background-color: rgb(260, 2450, 220); width: 100%;">
							<tbody>
								<tr valign="top" id="msg_b">
									<td align="center" colspan="6"><label class="arial12red"
										id="msg_board"><h4>
												<% out.println(msg);%>
											</h4></label></td>
								</tr>
								<tr valign="bottom" align="center" style="height: 20px;">
									<td><label class="red_heading">Report Type</label></td>
									<td class="red_heading">:</td>
									<td align="left"><select onchange="initStart()"
										style="width: 130px; height: 23px" id="reportType"
										name="reportType" class="textbox">
											<option value="FbUsage">FB Usage</option>
											<option value="WebApp">Web App</option>
											<option value="BdayWishUssd">BirthDay Wish</option>
											<option value="Revenue">Revenue</option>
											<option value="MostActive">MostActive</option>		
											<option value="FoneImUssd">FoneIM-USSD</option>																						
									</select></td>
								</tr>
								<tr valign="bottom" align="center" style="height: 20px;">
									<td><label class="red_heading">Operator</label></td>
									<td class="red_heading">:</td>
									<td align="left"><select onchange="getCountryList()"
										style="width: 130px; height: 23px" id="circle" name="operator"
										class="textbox">
											<option value="-1">Select</option>

									</select></td>
									<td align="right"><label
										class="red_heading">&nbsp;&nbsp;&nbsp; Country</label></td>
									<td class="red_heading">:</td>
									<td align="left" ><select 
										style="width: 130px; height: 23px" id="countryName"
										 name="countryName">
										 <option value="-1">Select</option>
										 </select>
										 </td>
								</tr>
								<tr valign="bottom" align="center" style="height: 20px;">
									<td><label class="red_heading">Circle</label></td>
									<td class="red_heading">:</td>
									<td align="left"><select
										style="width: 130px; height: 23px" id="circletype" name="circletype"
										class="textbox">
											<option value="consolidated">Consolidated</option>
											<option value="all">All</option>
									</select></td>
								</tr>
								<tr valign="bottom" align="center" style="height: 20px;">
									<td><label class="red_heading">Duration</label></td>
									<td class="red_heading">:</td>
									<td align="left"><select onchange="enb()" id="duration"
										name="type" style="width: 130px; height: 23px" class="textbox">
											<option value="daily">Daily</option>
											<option value="hourly">Hourly</option>
											<option value="monthly">Monthly</option>
									</select></td>
								</tr>

								<tr id="dateInput" valign="bottom" align="center"
									style="height: 20px;">
									<td><label class="red_heading">From Date</label></td>
									<td class="red_heading">:</td>
									<td align="left"><input type="text"
										style="width: 130px; height: 23px"
										onfocus="showCalendarControl(this);" name="startDate">
									</td>
									<td align="left" id="inputEdate"><label
										class="red_heading">&nbsp;&nbsp;&nbsp; Till Date</label></td>
									<td class="red_heading">:</td>
									<td align="left" id="inputEDate"><input type="text"
										style="width: 130px; height: 23px"
										onfocus="showCalendarControl(this);" name="endDate"></td>
								</tr>
								<tr id="hourlyInput" valign="bottom" align="center"
									style="height: 20px; visibility: hidden">
									<td><label class="red_heading">From Hour</label></td>
									<td class="red_heading">:</td>
									<td align="left"><select class="textbox"
										style="width: 130px; height: 23px" name="startHour"
										id="startHour">
											<option value="">Select</option>
											<option value="0">00 AM</option>
											<option value="1">01 AM</option>
											<option value="2">02 AM</option>
											<option value="3">03 AM</option>
											<option value="4">04 AM</option>
											<option value="5">05 AM</option>
											<option value="6">06 AM</option>
											<option value="7">07 AM</option>
											<option value="8">08 AM</option>
											<option value="9">09 AM</option>
											<option value="10">10 AM</option>
											<option value="11">11 AM</option>
											<option value="12">12 PM</option>
											<option value="13">01 PM</option>
											<option value="14">02 PM</option>
											<option value="15">03 PM</option>
											<option value="16">04 PM</option>
											<option value="17">05 PM</option>
											<option value="18">06 PM</option>
											<option value="19">07 PM</option>
											<option value="20">08 PM</option>
											<option value="21">09 PM</option>
											<option value="22">10 PM</option>
											<option value="23">11 PM</option>
									</select></td>
									<td align="left"><label class="red_heading">&nbsp;&nbsp;&nbsp;
											Till Hour</label></td>
									<td class="red_heading">:</td>
									<td align="left"><select class="textbox"
										style="width: 130px; height: 23px" name="endHour" id="endHour">
											<option value="">Select</option>
											<option value="0">00 AM</option>
											<option value="1">01 AM</option>
											<option value="2">02 AM</option>
											<option value="3">03 AM</option>
											<option value="4">04 AM</option>
											<option value="5">05 AM</option>
											<option value="6">06 AM</option>
											<option value="7">07 AM</option>
											<option value="8">08 AM</option>
											<option value="9">09 AM</option>
											<option value="10">10 AM</option>
											<option value="11">11 AM</option>
											<option value="12">12 PM</option>
											<option value="13">01 PM</option>
											<option value="14">02 PM</option>
											<option value="15">03 PM</option>
											<option value="16">04 PM</option>
											<option value="17">05 PM</option>
											<option value="18">06 PM</option>
											<option value="19">07 PM</option>
											<option value="20">08 PM</option>
											<option value="21">09 PM</option>
											<option value="22">10 PM</option>
											<option value="23">11 PM</option></td>
								</tr>
								<tr id="monthlyInput" valign="bottom" align="center"
									style="height: 20px; visibility: hidden">
									<td><label class="red_heading">From Month</label></td>
									<td class="red_heading">:</td>
									<td align="left"><select class="textbox"
										style="width: 130px; height: 23px" name="startMonth"
										id="startMonth">
											<option value="">Select</option>
											<option value="1">January</option>
											<option value="2">February</option>
											<option value="3">March</option>
											<option value="4">April</option>
											<option value="5">May</option>
											<option value="6">June</option>
											<option value="7">July</option>
											<option value="8">August</option>
											<option value="9">September</option>
											<option value="10">October</option>
											<option value="11">November</option>
											<option value="12">December</option>
									</select></td>
									<td align="left"><label class="red_heading">&nbsp;&nbsp;&nbsp;
											Till Month</label></td>
									<td class="red_heading">:</td>
									<td align="left"><select class="textbox"
										style="width: 130px; height: 23px" name="endMonth"
										id="endMonth">
											<option value="">Select</option>
											<option value="1">January</option>
											<option value="2">February</option>
											<option value="3">March</option>
											<option value="4">April</option>
											<option value="5">May</option>
											<option value="6">June</option>
											<option value="7">July</option>
											<option value="8">August</option>
											<option value="9">September</option>
											<option value="10">October</option>
											<option value="11">November</option>
											<option value="12">December</option></td>
								</tr>
								<tr valign="bottom" align="center" style="height: 20px;">
									<td colspan="6"><br> <input type="submit"
										value="ViewReport" name="view"
										style="height: 24px; width: 130px;" class="textbox"> <input
										type="submit" value="ExcelDownload" name="view"
										style="height: 24px; width: 130px;" class="textbox"></td>
								</tr>
							</tbody>
						</table>
					</form>
				</div>
				<p class="clear"></p>
			</div>
			<!-- content -->
		</div>
		<!--End COntent Area-->
		<div class="footer">
			<!-- Footer Area-->
			Copyright &copy; U2opia Mobile Pvt. Ltd
		</div>
		<div class="footer_info">
			Design from <a href="http://www.u2opiamobile.com/">U2opia Mobile</a>
		</div>
</body>
</html>
